package com.coreJava.设计模式.观察者模式2;

import java.util.Vector;

/**
 * 作者: LCG
 * 日期: 2020/6/28 22:18
 * 描述:
 * @author lenovo
 */
public class GuanChaZheManger {

     private Vector<GUanChaZheInterface> vector=new Vector<>();

    /**
     * 注册一个观察者
     * @param gUanChaZheInterface
     */
     public void register(GUanChaZheInterface gUanChaZheInterface){
         vector.add(gUanChaZheInterface);
     }

    /**
     * 删除一个观察者
     * @param gUanChaZheInterface
     */
     public void delete(GUanChaZheInterface gUanChaZheInterface){
         vector.remove(gUanChaZheInterface);
     }

    /**
     * 通知所有的客户端
     */
    public void notifyAllClient(){
        vector.forEach(gcz->{
            gcz.watcher();
        });
    }


}
